﻿CREATE TABLE [dbo].[sla_log_entries]
( 
	sla_log_entry_id bigint IDENTITY(1,1) not null,
	content_item_id bigint null,
	previous_state_id bigint not null, 
	previous_state_date datetime not null,
	prvious_state_user_id bigint not null,
	new_state_id bigint not null, 
	new_state_date datetime not null,
	[user_id] bigint not null,
	[discriminator] NVARCHAR(250) NOT NULL, 
    [blog_id] BIGINT NULL, 
    CONSTRAINT [PK_sla_log_entry_id] PRIMARY KEY CLUSTERED ([sla_log_entry_id] ASC), 
    CONSTRAINT [FK_sla_log_entries_content_item] FOREIGN KEY ([content_item_id]) REFERENCES [content_item]([content_item_id]),
	CONSTRAINT [FK_sla_log_entries_publish_state] FOREIGN KEY ([previous_state_id]) REFERENCES [publish_state]([publish_state_id]),
	CONSTRAINT [FK_sla_log_entries_prvious_state_user] FOREIGN KEY ([prvious_state_user_id]) REFERENCES [users]([user_id]),
	CONSTRAINT [FK_sla_log_entries_user] FOREIGN KEY ([user_id]) REFERENCES [users]([user_id]),
	CONSTRAINT [FK_sla_log_entries_new_state] FOREIGN KEY ([new_state_id]) REFERENCES [publish_state]([publish_state_id])
);
